/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __TERRAIN_TEXTURE_DIALOG_H__
#define __TERRAIN_TEXTURE_DIALOG_H__

#include <map>

#include <QtGui/QListWidget>
#include <QtGui/QDialog>

namespace PQBuilder
{
	class TerrainTextureListWidget
		: public QListWidget
	{
	public:
		static const int GRID_ROW_HEIGHT=32;
		static const int GRID_SIZE_X = 52;
		static const int GRID_SIZE_Y= 64;
		static const int ICON_SIZE=48;
		
	protected:
		void dragEnterEvent(QDragEnterEvent *evt);
		void dropEvent(QDropEvent *evt);
		void dragLeaveEvent(QDragLeaveEvent *evt);
		void dragMoveEvent(QDragMoveEvent *evt);
	public:
		TerrainTextureListWidget(QWidget* parent);
		void addIcon(QString texturePath);

		QString getSelectedTextureName();
	private:
		void loadIcons();
	};

	//for select texture
	class TerrainTextureDialog
		: public QDialog
	{
		Q_OBJECT
	private:
		static TerrainTextureDialog* _dialog;
		bool _isOk;
		TerrainTextureListWidget* _textureListWidget;
		
	protected:
		TerrainTextureDialog(QWidget* parent=0);
	public:
		static QString getTexturePath();
		inline bool isOK()
		{
			return _isOk;
		}
		inline QString getSelectedTextureName()
		{
			return _textureListWidget->getSelectedTextureName();
		}
signals:
		void OnAddTerrainTextureLayer(std::string texturePath);
	public slots:
		void okClicked();
		void cancelClicked();
	};
}

#endif
